<?php

defined('_JEXEC') or die;

class BakerysControllerOrders extends JControllerAdmin
{

	public function getModel($name = 'Order', $prefix = 'BakerysModel', $config = array('ignore_request' => true))
	{
		$model = parent::getModel($name, $prefix, $config);
		return $model;
	}

	public function delivery()
	{
		
		// Get the input
		$input = JFactory::getApplication()->input;
		$pks = $input->post->get('cid', array(), 'array');

		// Sanitize the input
		JArrayHelper::toInteger($pks);

		// Get the model
		$model = $this->getModel();

		$model->delivery($pks);
		$this->setRedirect("index.php?option=com_bakerys&view=orders",count($pks) ." items delivered");
		
	}
	
	public function undelivered()
	{
		
		// Get the input
		$input = JFactory::getApplication()->input;
		$pks = $input->post->get('cid', array(), 'array');

		// Sanitize the input
		JArrayHelper::toInteger($pks);

		// Get the model
		$model = $this->getModel();

		$model->undelivered($pks);
		$this->setRedirect("index.php?option=com_bakerys&view=orders",count($pks) ." items undelivered");
		
	}
}
